#ifndef WINDOWREDUCER_H
#define WINDOWREDUCER_H

#include <set>
#include <map>
#include <windows.h>

class WindowReducer;


#include "Utilities.h"
#include "CassiopeiaComponent.h"

using namespace std;


class WindowReducer
{
public:
	struct Size
	{
		int Width;
		int Height;
	};

	struct ReducedData
	{
		Size Size;
	};

	WindowReducer();
	~WindowReducer();
		
	void Add(HWND hWnd);
	void Remove(HWND hWnd);
	bool Exists(HWND);	
private:
	map<HWND, ReducedData> windowsForReducing;
	int menuHeight;
	int captionHeight;
	int frameHeight;
	int smallCaptionHeight;
	int minHeight;
	int minSmallHeight;

	void ResetReducedWindows();
	void ReduceWindowsExceptOne(HWND, HWND = (HWND)-1);
	void RestoreReducedWindow(HWND);
	void ReduceWindow(HWND);
	
	static set<WindowReducer*> instances;
	static HWINEVENTHOOK hWinEventHook;

	static VOID CALLBACK WinEventProc(HWINEVENTHOOK hWinEventHook,DWORD dwEvent,HWND hWnd,LONG idObject,LONG idChild,DWORD idEventThread,DWORD dwmsEventTime);
};

#endif